//
//  LKMyViewController.m
//  YLHelper
//
//  Created by she1323 on 2018/5/10.
//  Copyright © 2018年 she1323. All rights reserved.
//

#import "LKMyViewController.h"
#import "LKMineCell.h"
#import "LKMyCollectionViewController.h"
#import "LKMyTestRecordViewController.h"
#import "LKMyVideoViewController.h"
@interface LKMyViewController ()<UITableViewDataSource,UITableViewDelegate>
@property(nonatomic,strong)LKBaseTableview *tableview;
@property(nonatomic,strong)NSArray *titlesArray;
@property(nonatomic,strong)NSArray *imagesArray;
@end

@implementation LKMyViewController

-(LKBaseTableview *)tableview{
    if (!_tableview) {
        _tableview = [LKBaseTableview setTableviewWithFrame:CGRectMake(0, NAVIGATION_BAR_HEIGHT, WIDTH, HEIGHT - TAB_BAR_HEIGHT) style:UITableViewStyleGrouped registercellClasss:@[@"LKMineCell"]];
        [self.view addSubview:_tableview];
        _tableview.delegate = self;
        _tableview.dataSource = self;
        _tableview.backgroundColor = cellHeaderBgColor;
    }
    return _tableview;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.tableview reloadData];
    // Do any additional setup after loading the view.
}
-(void)setNavgationBackBtn{
    [super setNavgationBackBtn];
    self.navigationItem.title = @"记录";
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return self.titlesArray.count;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
//    LKMineCell *cell = [tableView dequeueReusableCellWithIdentifier:@"LKMineCell"];
    UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cellId"];
    cell.textLabel.text = self.titlesArray[indexPath.section];
    cell.imageView.image = [UIImage imageNamed:self.imagesArray[indexPath.section]];
    cell.textLabel.textColor = cellTextColor;
    cell.textLabel.font = [UIFont systemFontOfSize:15];
    cell.backgroundColor = [UIColor whiteColor];
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return section == 0 ? 12:0.000000000001;
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 1;
}
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    UIView *headerView = [[UIView alloc] init];
    headerView.backgroundColor = cellHeaderBgColor;
    return headerView;
    
}
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    UIView *footerView = [[UIView alloc] init];
    footerView.backgroundColor = cellHeaderBgColor;
    return footerView;
}

-(NSArray *)titlesArray{
    if (!_titlesArray) {
        _titlesArray = @[@"我的收藏",@"考试记录",@"看过的视频"];
    }
    return _titlesArray;
}
-(NSArray *)imagesArray{
    if (!_imagesArray) {
        _imagesArray = @[@"mycollection",@"mytestrecored",@"myvideo"];
    }
    return _imagesArray;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    switch (indexPath.section) {
        case 0:
            {
                LKMyCollectionViewController *vc = [[LKMyCollectionViewController alloc] init];
                [self.navigationController pushViewController:vc animated:YES];
            }
            break;
        case 1:
        {
            LKMyTestRecordViewController *vc = [[LKMyTestRecordViewController alloc] init];
            [self.navigationController pushViewController:vc animated:YES];
        }
            break;
            case 2:
        {
            LKMyVideoViewController *vc = [[LKMyVideoViewController alloc] init];
            [self.navigationController pushViewController:vc animated:YES];
        }
            break;
        default:
            break;
    }
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
